﻿using System;
using System.Collections.Generic;
using System.Text;
using Estimate.Common.DataFileFinder;
using Estimate.Common.DataImporter;
using System.Configuration;
using System.IO;
using Estimate.Common.Estimate;
using Estimate.Common.Entity;
using Estimate.Common.DBFieldTypes;
using Estimate.Common.Repository;
using Estimate.Common;
using Estimate.Reports;
using log4net;

[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace BuildData
{
    class Program
    {
        static void Main(string[] args)
        {

            ILog Logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            DataImporterCombiner combiner = new DataImporterCombiner(ConfigurationManager.AppSettings);

            string connectionString = ConfigurationManager.AppSettings["ConnectionString"];

            try
            {
                Console.WriteLine();
                Console.WriteLine("===================={0}===================", "正在生成预报员排名数据");
                //导入省台预报员排名数据
                AutoImportForecasterRankReportData ImportForecasterRankReportData = new AutoImportForecasterRankReportData(connectionString);

                ImportForecasterRankReportData.AddForecasterRankReportData();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            try
            {
                Console.WriteLine();
                Console.WriteLine("===================={0}===================", "正在生成预报产品排名数据");


                string foreproductsString = ConfigurationManager.AppSettings["ForeProducts"];

                Dictionary<string, string> foreproducts = new Dictionary<string, string>();
                foreach (string s in foreproductsString.Split('|'))
                {
                    string[] strs = s.Split(';');
                    foreproducts.Add(strs[0], strs[1]);
                }


                AutoImportForeProductRankReportData ImportForeProductRankReportData = new AutoImportForeProductRankReportData(foreproducts,connectionString);

                ImportForeProductRankReportData.AddForeProductRankReportData();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }


           
        }
    }
}
